<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" placeholder="请输入1-100之间的整数" v-model="x">
  <input type="button" value="猜一猜" @click="f()"><br>
  <h1>{{info}}</h1>
</div>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
<script>
  let number = parseInt(Math.random() * 100) + 1;
  let v = new Vue({
    el:"div",
    data:{
      info:"",
      x:"",
    },
    methods:{
      f(){
        if (v.x > number) {
          v.info = "大了";
        } else if (v.x < number) {
          v.info = "小了";
        } else {
          v.info = "猜对了";
        }
      }
    }
  })
</script>
</body>
</html>